#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

inline void swap(int &a, int &b)
{
	int tmp=a;
	a=b;
	b=tmp;
}

int partition(int arr[], int left, int right)
{
	int pivot=left + rand()%(right-left);
	swap(arr[pivot],arr[right]);
	
	int store=left;
	for(int i=left; i<=right-1; ++i){
		if(arr[i]<arr[right]){
			swap(arr[i],arr[store]);
			store++;
		}
	}
	swap(arr[store],arr[right]);
	return store;
}

void qsort(int arr[], int left, int right)
{
	if(left>=right)
		return;
	int pivot=partition(arr,left,right);
	qsort(arr,left,pivot-1);
	qsort(arr,pivot+1,right);
}

int main()
{
	int a=1,b=2;
	
	srand((unsigned)time(0));
	int const size=5;
	int data[size];
	for(int i=0; i< size; ++i){
		cin>>data[i];
	}
	qsort(data,0,size-1);
	for(int i=0; i< size; ++i){
		cout<<data[i]<<endl;
	}
	system("Pause");
	return 0;
}